<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>厦门市政法教育整顿</title>
    <link rel="apple-touch-icon" sizes="180x180" href="zfw-logo.png">
    <link rel="icon" type="image/png" sizes="32x32" href="zfw-logo.png">
    <!-- layui样式 -->
    <link rel="stylesheet" href="./component/layui/css/layui.css">
    <!-- Y-Admin核心样式 -->
    <link rel="stylesheet" href="./css/yadmin.css">
    <!-- 公共样式 -->
    <link rel="stylesheet" href="./css/common.css">
    <!-- 首页样式（只为此页面使用） -->
    <link rel="stylesheet" href="./css/index.css">
    <link rel="stylesheet" href="./css/load.css" />
    <script src="./js/myUtils.js"></script>
    <style>
        .layui-side .layui-nav * {
            font-size: 18px;
        }
    </style>
</head>

<body class="layui-layout-body">
    <div class="loader-main">
        <div class="loader"></div>
    </div>
    <div class="layui-layout layui-layout-admin" loading=600>

        <div class="layui-header">
            <!-- logo 区域 -->
            <div class="layui-logo">
                <!-- <img src="zfw-logo.png" alt="logo" style="margin-left: -5px;" /> -->
                <cite>
                    线索管理平台&emsp;
                </cite>
            </div>

            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item" lay-unselect>
                    <a lay-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right"></i>
                    </a>
                </li>
                <!-- 面包屑 -->
                <span class="layui-breadcrumb layui-anim layui-anim-up">
                    <a><cite>数据统计</cite></a>
                </span>
            </ul>

            <!-- 头像区域 -->
            <ul class="layui-nav layui-layout-right">

                <li class="layui-nav-item layui-hide-xs" id="chromeDownload">
                    <!-- <a target="_blank" href="http://www.pearadmin.com" class="layui-icon layui-icon-website" title="浏览器"></a> -->
                </li>

                <li class="layui-nav-item layui-hide-xs" id="wpsDownload">
                    <!-- <a target="_blank" href="http://www.pearadmin.com" class="layui-icon layui-icon-read" title="WPS"></a> -->
                </li>

                <li class="layui-nav-item feature-items" id="remindUrgentDIV">

                </li>

                <li class="layui-nav-item feature-items">
                    <a id="screenFull" lay-event="screenFull" title="全屏">
                        <i style="font-size: 18px;" class="layui-icon layui-icon-screen-full"></i>
                    </a>
                    <a id="screenRestore" lay-event="screenRestore" title="退出全屏" style="display: none;">
                        <i style="font-size: 18px;" class="layui-icon layui-icon-screen-restore"></i>
                    </a>
                </li>

                <!-- 用户信息 -->
                <li class="layui-nav-item" id="userInfoDiv" style="margin-right: 20px;">

                </li>
            </ul>
        </div>

        <!-- 左侧导航区域 -->
        <div class="layui-side">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree" lay-filter="lay-nav" lay-accordion="true">
                    <li class="layui-nav-item">
                        <a lay-url="/view/home/index.html" lay-id="home">
                            <i class="layui-icon layui-icon-chart-screen"></i>&emsp;<cite
                                style="margin-left: 20px;">数据统计</cite>
                        </a>
                    </li>

                    <li class="layui-nav-item">
                        <a lay-id="excel-list" lay-url="view/excel/excel-list.html">
                            <i class="layui-icon layui-icon-search"></i>&emsp;<cite
                                style="margin-left: 20px;">线索筛选</cite>
                        </a>
                    </li>

                    <li id="infoManger" class="layui-nav-item">
                        <a lay-id="#" lay-url="#">
                            <i class="layui-icon layui-icon-form"></i>&emsp;<cite style="margin-left: 20px;">线索管理</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a id="addExcelMenu" lay-id="/excel/add" lay-url="view/excel/excel-add.html">
                                    <cite>新增线索</cite>
                                </a>
                            </dd>
                            <dd>
                                <a id="tmpSaveMenu" lay-id="list-tempsave"
                                    lay-url="view/excel/excel-list.html?type=tempsave">
                                    <cite>暂存列表</cite>
                                </a>
                            </dd>
                            <dd>
                                <a id="sendBackMenu" lay-id="list-sendBack"
                                    lay-url="view/excel/excel-list.html?type=sendBack">
                                    <cite>退回列表</cite>
                                </a>
                            </dd>
                            <dd>
                                <a id="checkMenu" lay-id="list-check"
                                    lay-url="view/excel/excel-list.html?type=check">
                                    <cite>审核列表</cite>
                                </a>
                            </dd>
                            <!-- <dd>
                                <a lay-id="/nav/attachment" lay-url="view/nav/attachment.html">
                                    <cite>附件管理</cite>
                                </a>
                            </dd> -->
                        </dl>
                    </li>

                    <li id="personManger" class="layui-nav-item">
                        <a lay-id="#" lay-url="#">
                            <i class="layui-icon layui-icon-user"></i>&emsp;<cite style="margin-left: 20px;">人员聚类</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a id="reporter" lay-id="reporter" lay-url="view/excel/excel-person.html?type=reporter">
                                    <cite>举报人</cite>
                                </a>
                            </dd>
                            <dd>
                                <a id="reporteder" lay-id="reporteder" lay-url="view/excel/excel-person.html?type=reporteder">
                                    <cite>被举报人</cite>
                                </a>
                            </dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item">
                        <a id="userManger" lay-id="/nav/user" lay-url="view/nav/user.html">
                            <i class="layui-icon layui-icon-set-fill"></i>&emsp;<cite style="margin-left: 20px;">用户管理</cite>
                        </a>
                    </li>

                    <li class="layui-nav-item">
                        <a id="historyMenu" lay-id="/excel/excel-history" lay-url="view/excel/excel-history.html">
                            <i class="layui-icon layui-icon-time"></i>&emsp;<cite style="margin-left: 20px;">修改记录</cite>
                        </a>
                    </li>
                </ul>

            </div>
        </div>

        <div class="layui-body">
            <div class="layui-pagetabs">
                <div class="layui-icon admin-tabs-control layui-icon-refresh-3" lay-event="refresh"></div>
                <div class="layui-tab" lay-unauto lay-allowclose="true" lay-filter="lay-tab">
                    <ul class="layui-tab-title">
                        <li lay-id="home" lay-url="/view/home/index.html" class="layui-this"><i
                                class="layui-icon layui-icon-home"></i></li>
                    </ul>
                    <div class="layui-tab-content" id="con_min">
                        <div id="homeIndex" class="layui-tab-item layui-show">
                            <!-- <iframe src="/view/home/console1.html" class="layui-iframe"></iframe> -->
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 底部固定区域 -->
        <div id="yearDiv">

        </div>

        <!-- 移动端遮罩 -->
        <div class="site-mobile-shade"></div>
    </div>

    <!-- layui JS -->
    <script src="./component/layui/layui.js"></script>

    <!-- jQuery JS -->
    <script src="./js/jquery.js"></script>
    <!-- 公共JS -->
    <script src="./component/pear/pear.js"></script>

    <script id="getDownloadUrl" type="text/html">
        {{# if(d.type === 'chrome'){ }}
        <a target="_blank" href="{{d.url}}" class="layui-icon layui-icon-website" title="浏览器"></a>
        {{#  } else if(d.type === 'wps') { }}
        <a target="_blank" href="{{d.url}}" class="layui-icon layui-icon-read" title="WPS"></a>
        {{# } }}
    </script>

    <script id="remindUrgentView" type="text/html">
        {{# if(d.length == 0){ }}
        <span class="layui-badge-dot notification-none"></span>
        <a lay-event="">
            <i class="notice layui-icon layui-icon-notice"></i>
        </a>
        {{# } else { }}
        <span class="notification-count">{{d.length}}</span>
        <a lay-event="todo">
            <i class="notice layui-icon layui-icon-notice"></i>
        </a>
        {{# } }}
    </script>

    <script id="userInfo" type="text/html">
        <a style="font-weight: bold;">
            <!-- <img src="images/avatar.png" class="layui-nav-img" alt="头像"> -->
            <i style="font-size: 18px;" class="layui-icon layui-icon-username"></i>
            <cite>{{d.name}}</cite>
            <span class="layui-nav-more"></span>
        </a>
        <dl class="layui-nav-child">
            {{# if(d.role === 0){ }}
            <dd lay-unselect>
                <a lay-event="addUser">新增用户</a>
            </dd>
            {{# } }}
            <dd lay-unselect>
                <a lay-event="editPwd">修改密码</a>
            </dd>
            <hr>
            <dd lay-unselect>
                <a lay-event="logout">退出</a>
            </dd>
        </dl>
    </script>

    <script id="year" type="text/html">
        <div class="layui-footer">
            copyright © {{d}} 厦门市政法委版权所有
        </div>
    </script>

    <script id="homeIndexIframe" type="text/html">
        {{# if(d.departmentCode == -2){ }}
        <iframe src="./view/home/console1.html" class="layui-iframe"></iframe>
        {{# } else { }}
        <iframe src="./view/home/console2.html" class="layui-iframe"></iframe>
        {{# } }}
    </script>

    <script>
        var userInfoData = layui.data('userInfo').item

        layui.use(['laytpl', 'Api', 'layer', 'request'], function () {
            var laytpl = layui.laytpl,
                layer = layui.layer,
                request = layui.request,
                Api = layui.Api;

            // console.log("userInfoData: ", userInfoData)
            if (JSON.stringify(userInfoData) == "{}") {
                layer.alert('登录已过期！', { icon: 5 }, function () {
                    self.location = './index.html'
                })
            }

            initTpl()
            initMenu()
            initUrgent()
            getOptions()
            initWater()

            function initWater() {
                markText = userInfoData.name + ' ' + myUtils.getToday()
                myUtils.watermark(markText)
            }

            function initUrgent() {
                var params = {
                    page_index: 1,
                    page_size: 100
                }
                var success = function (res) {
                    if (res.errno == 0) {
                        var data = res.data
                        // console.log("getUrgent data:", data)
                        var dataList = data.list
                        for (var i = 0; i < dataList.length; i++) {
                            var sendTime = dataList[i].sendTime
                            var feedbackTimeLimit = dataList[i].feedbackTimeLimit
                            var feedbackTime = myUtils.dayAdd(sendTime, parseInt(feedbackTimeLimit))
                            dataList[i].feedbackTime = feedbackTime
                        }
                        data.list = dataList
                        let tplDate = dataList.length
                        if (tplDate > 99) {
                            tplDate = '99+'
                        }
                        // console.log("tplDate:", tplDate)
                        var getTpl = remindUrgentView.innerHTML,
                            view = document.getElementById('remindUrgentDIV');
                        laytpl(getTpl).render({
                            length: tplDate
                        }, function (html) {
                            view.innerHTML = html;
                        });
                    } else {
                        layer.msg(res.errmsg, {
                            icon: 2
                        })
                    }
                }
                request.get(Api.homeUrgent, params, success)
            }

            function initTpl() {
                /** 获得WPS和Chrome下载链接 **/
                var getDownloadUrlTpl = getDownloadUrl.innerHTML,
                    wpsDownloadDiv = document.getElementById('wpsDownload'),
                    chromeDownloadDiv = document.getElementById('chromeDownload');

                laytpl(getDownloadUrlTpl).render({
                    type: 'wps',
                    url: Api.baseUrl + 'files/wps64.exe'
                }, function (html) {
                    wpsDownloadDiv.innerHTML = html;
                });

                laytpl(getDownloadUrlTpl).render({
                    type: 'chrome',
                    url: Api.baseUrl + 'files/mini_installer.exe'
                }, function (html) {
                    chromeDownloadDiv.innerHTML = html
                });

                /** 初始化右上角用户信息 **/
                var userInfoTpl = userInfo.innerHTML, //获取模板，即上面所定义的 <script id="userInfo">
                    userInfoDiv = document.getElementById('userInfoDiv'); //视图 即上面的 <div id="userInfoDiv">

                laytpl(userInfoTpl).render(userInfoData, function (html) { //渲染视图
                    userInfoDiv.innerHTML = html;
                });

                /** 初始化数据展示界面 **/
                var homeIndexTpl = homeIndexIframe.innerHTML,
                    homeIndexDiv = document.getElementById('homeIndex');
                laytpl(homeIndexTpl).render(userInfoData, function (html) {
                    homeIndexDiv.innerHTML = html;
                });

                /** 初始化footer信息 **/
                var myDate = new Date();
                var tYear = myDate.getFullYear();

                var yearTpl = year.innerHTML,
                    yearDiv = document.getElementById('yearDiv');
                laytpl(yearTpl).render(tYear, function (html) {
                    yearDiv.innerHTML = html;
                });
            }

            function initMenu() {
                if (userInfoData == undefined) {
                    layer.alert('登录已过期！', { icon: 5 }, function () {
                        self.location = './index.html'
                    })
                }
                // console.log("initHistoryMenu userInfoData: ", userInfoData)
                if (userInfoData.role != 0) {
                    // 无权限查看，隐藏按钮
                    $('#historyMenu').hide()
                }
                if (userInfoData.departmentCode != -2) {
                    $('#historyMenu').hide()
                    $('#infoManger').hide()
                }
                if (userInfoData.username != 'shan') { // 仅杉哥可以管理用户
                    $('#userManger').hide()
                }
            }

            function getOptions() {
                var success = function (res) {
                    var data = res.data
                    var options = {
                        blackDepartment: myUtils.renameOption(data.blackDepartment),
                        caseContentOne: myUtils.renameOption(data.caseContentOne),
                        caseContentTwo: myUtils.renameOption(data.caseContentTwo),
                        caseType: myUtils.renameOption(data.caseType),
                        conclusion: myUtils.renameOption(data.conclusion),
                        fourShapes: myUtils.renameOption(data.fourShapes),
                        involvedUnit: myUtils.renameOption(data.involvedUnit),
                        isRepeat: myUtils.renameOption(data.isRepeat),
                        issueType: myUtils.renameOption(data.issueType),
                        level: myUtils.renameOption(data.level),
                        processResult: myUtils.renameOption(data.processResult),
                        progress: myUtils.renameOption(data.progress),
                        reportFrom: myUtils.renameOption(data.reportFrom),
                        reportType: myUtils.renameOption(data.reportType),
                        reportState: myUtils.renameOption(data.reportState),
                        sendDepartment: myUtils.renameOption(data.sendDepartment),
                        title: myUtils.renameOption(data.title),
                        reportCaseType: myUtils.renameOption(data.reportCaseType),
                        isPolice: [{ value: 1, label: '政法干警' }, { value: 0, label: '非政法干警' }]
                    }
                    layui.data('options', { key: 'data', value: options });
                }
                request.get(Api.getOptions, {}, success)
            }

            setTimeout(function () {
                $(".loader-main").fadeOut(200);
            }, 1200)
        })

    </script>
</body>

</html>